// 数组转化为树形结构
function arrayToTree(arr) {
    const tree = arr.filter(items => {
        const child = arr.filter(item => item.parentId === items.Id)
        if (child.length > 0) {
            items.children = child
        }
        return items.parentId === 0
    })
    return tree
}
function menuToTree(arr, arrParent) {
    let tree = []
    let child = []
    tree = arrParent.filter(items => {
        child = arr.filter(item => items.Id === item.parentId)
        if (child.length > 0) {
            items.children = child
            return items.parentId === 0
        }
    })
    return tree
}
module.exports = {
    arrayToTree,
    menuToTree
}